package com.ruijie.acl.web;

import java.util.List;

import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;

import com.ruijie.acl.TimeRange;
import com.ruijie.acl.service.TimeRangeService;
import com.ruijie.foundation.bo.EntityObject;
import com.ruijie.foundation.service.Repository;

/**
 * <p>
 * Title: ACL设备中时间段比对管理Action类

 * </p>
 * <p>
 * Description:
 * </p>
 * <p>
 * 为ACL设备中时间段比对管理模块提供页面数据的显示、获取和页面的跳转。

 * </p>
 * <p>
 * Copyright: Copyright (c) 2008
 * </p>
 * <p>
 * Company: Ruijie Co., Ltd.
 * </p>
 * <p>
 * Create Time: 
 * </p>
 * <p>
 * </p>
 * <p>
 * Update Time:
 * </p>
 * <p>
 * Updater:
 * </p>
 * <p>
 * Update Comments:
 * </p>
 * @author ASAI
 */
@Name("contrastTimeRangeAction")
@Scope(ScopeType.CONVERSATION)
public class ContrastTimeRange extends AclBaseAction {

	@In("#{timeRangeService}")
	private TimeRangeService timeRangeService;

	private TimeRange model;

	private TimeRange sysModel;

	private TimeRange devModel;

	public String doContrast(String name,Long id) {
		
		List<TimeRange> list = timeRangeService.getByName(name);
		for(TimeRange timeRange : list) {
			if(timeRange.getAclDevice() == null) {
				sysModel = timeRange;
			}else {
				if(timeRange.getAclDevice().getId().equals(id)){
					devModel = timeRange;
				}
			}
		}
		return getDetailPage();
	}
	
	@Override
	@SuppressWarnings("unchecked")
	protected Repository getRepository() {
		return timeRangeService;
	}

	@Override
	protected String getAddPage() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public EntityObject getCriteria() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	protected String getDetailPage() {
		return "/acl/components/contrastTimeRange.seam";
	}

	@Override
	protected String getListPage() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public EntityObject getModel() {
		return model;
	}

	@Override
	protected String getUpdatePage() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void resetModel() {
		this.model = null;
		model = new TimeRange();

	}

	@Override
	public void setCriteria(EntityObject criteria) {
		// TODO Auto-generated method stub

	}

	@Override
	public void setModel(EntityObject model) {
		this.model = (TimeRange) model;

	}

	public TimeRange getSysModel() {
		return sysModel;
	}

	public void setSysModel(TimeRange sysModel) {
		this.sysModel = sysModel;
	}

	public TimeRange getDevModel() {
		return devModel;
	}

	public void setDevModel(TimeRange devModel) {
		this.devModel = devModel;
	}

}
